using ASP;
using HoWave.Common;
using System;
using System.Data;
using System.Text;
using System.Web.Profile;
using System.Web.UI;
using System.Web.UI.WebControls;
public class UserControls_index_ctrl1 : UserControl
{
	protected Repeater Repeater_Data;
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	public int classid
	{
		get;
		set;
	}
	public int selectcount
	{
		get;
		set;
	}
	public int selectindex
	{
		get;
		set;
	}
	public int datacount
	{
		get;
		set;
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!base.IsPostBack)
		{
			string text = "UserControls_index_ctrl1_dt9" + this.classid;
			DataTable dataTable = DataCache<DataTable>.GetCache(text);
			if (dataTable == null || dataTable.Rows.Count == 0)
			{
				StringBuilder stringBuilder = new StringBuilder();
				stringBuilder.Append("select top 9 ");
				stringBuilder.Append(" p.ProductID,p.ProductName,p.ClassID,p.ProductImageUrl ");
				stringBuilder.Append(" ,p.ProductType,p.CurrentPrice,p.StandPrice,p.Stocks ");
				stringBuilder.Append(" from HLShop_Product p ");
				stringBuilder.Append(" where IsApprove=1 and EnableSale=1  ");
				stringBuilder.Append(" and EnableSingleSell=1 and Stocks>0 ");
				stringBuilder.AppendFormat(" and classid={0} ", this.classid);
				stringBuilder.Append(" order by p.IsPageElite desc,p.BuyTimes desc,UpdateTime desc ");
				dataTable = Conn.Query(stringBuilder.ToString(), new IDbDataParameter[0]).Tables[0];
				stringBuilder.Clear();
				DataCache.SetCacheSecond(text, dataTable, 1, DataCache.NoSlidingExpiration);
			}
			DataTable dataTable2 = dataTable;
			dataTable2 = dataTable2.SubTable(this.selectcount, this.selectindex);
			if (this.datacount > 0)
			{
				dataTable2 = dataTable2.PlusTable(this.datacount, new bool[0]);
			}
			this.Repeater_Data.DataSource = dataTable2;
			this.Repeater_Data.DataBind();
		}
	}
}
